package com.lxw.test1.mutiDownload;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.UUID;

public class WebDownloader {

    // 下载方法
    public void downloader(String url) {
        try {
            String name1 = "d:/CodeReference/img/img/" + UUID.randomUUID() + ".jpg";
            System.out.println(name1);
            FileUtils.copyURLToFile(new URL(url), new File(name1));
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("IO异常");
        }
    }
}

